package com.wwg.cms.service.impl;

import java.util.Collection;
import com.wwg.cms.bo.*;
import com.wwg.cms.service.*;
import com.css.framework.dao.GeneralDao;

import com.wwg.cms.bo.entity.*;

/**
 * 
 * create by wwl
 * 
 * @author wwl
 */
public class RoleServiceImpl implements RoleService{

    private GeneralDao generalDao;
      
    public void setGeneralDao(GeneralDao generalDao) {
	        this.generalDao = generalDao;
	}
    
   
    
    /**
	 *获取所有
	 */
	public Collection getRoleList(){
     String hsql="select ent from RoleEntity as ent ";
     return generalDao.find(hsql);
    
    }
	
	/**
	 * 添加
	 * @param role 
	 * @return
	 */
	public Role addRole(Role role){
   
			generalDao.save(role);
		    
    return role;
    
    }
	
	/**
	 * 修改
	 * @param role 
	 * @return
	 */
	public  Role updateRole(Role role){
    
            generalDao.saveOrUpdate(role); 
	
        
        return role;
    }
	
	/**
	 * 删除
	 * @param role 
	 * @return
	 */
	public Role deleteRole(Role role){
      		generalDao.delete(role);
		
        return role;
    }
    
    /**
     *  获取 by id
     *  @param id 编号
     * @return
	 */
    public Role getRoleById(Long id){
    
   
     return (Role)generalDao.fetch(id,RoleEntity.class);
    
    }
    
}
